#include "fns.h"

#include <math.h>

/** Trignometric sin() function.  Argument in radians. */
static double 
sinFn(double x) 
{ 
  return sin(x); 
}
/** Function from <http://en.wikipedia.org/wiki/Integral>.  Integral from
 *  -2 to +2 is 3.76.
 */
static double 
wikipediaFn(double x) 
{
  return 0.2 * (0.01*(322 + 3*x*(98 + x * (37 + x))) - 24*x/(1 + x*x));
}

/** Array mapping function names to definitions. */
FnDef fns[] = {
  { "sin", sinFn },
  { "wikipedia", wikipediaFn },
};

/** # of entries in fns[] array. */
int nFns = sizeof(fns)/sizeof(fns[0]);

